<?php
/**
 * Index.php 
 * 
 */
get_header();
?>
		<?php
			if(!is_single()) {
				include(TEMPLATEPATH . '/filter_projects.php');
			}
		?>
		
		<?php
			global $query_string;
			query_posts($query_string . '&orderby=title&order=asc'); 
		?>
		<?php if(have_posts()): ?>
			<?php while(have_posts()) : the_post(); ?>
		
				<?php include(TEMPLATEPATH . '/post.php'); ?>
	
		<?php endwhile; ?>
		
		<?php if(is_single() || is_paged()) { ?>
			<div class="pagination tier">
				<div class="xMain column">
					<?php if(is_single()) { ?>
					
						<span class="prev"><?php next_post_link( '%link', 'Previous', TRUE) ?></span>
						<span class="list index"><a href="<?php bloginfo('url'); ?>/projects" class="card">Project list</a></span>			
						<span class="next"><?php previous_post_link( '%link', 'Next', TRUE) ?></span>
					
					<?php } else { ?>
					
						<span class="prev"><?php previous_posts_link('Previous Page'); ?></span>
						<span class="next"><?php next_posts_link('Next Page'); ?></span>
					
					<?php } ?>		
				</div>	
			</div>
		<?php } ?>	
		
		<?php else: ?>
			
			<?php include(TEMPLATEPATH . '/notFound.php'); ?>
	
		<?php endif; ?>
		<?php wp_reset_query(); ?>
	
		<?php get_footer(); ?>